<?php

namespace App\Models;



use Illuminate\Database\Eloquent\SoftDeletes;

class OrderComment extends Base
{
    use SoftDeletes;
    const TYPE_SERVICE = 1;

    protected $casts = [
        'file' => 'array',
    ];

    protected $fillable = ['user_id', 'entity_id', 'type', 'message', 'appoint_id', 'star', 'reply_message'
        , 'is_anonymous', 'file'];

    public function user() {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function appoint() {
        return $this->belongsTo(Appoint::class, 'appoint_id');
    }

    public function service() {
        return $this->belongsTo(Service::class, 'entity_id');
    }

    public function setFileAttribute($value) {
        return $this->attributes['file'] = $value;
    }

}
